//
//  ZYCMessageDutyCell.m
//  ZDSC
//
//  Created by ZDTX on 2021/8/30.
//

#import "ZYCMessageDutyCell.h"
#import "ZYCMessageDutyModel.h"

@interface ZYCMessageDutyCell ()

@property (nonatomic, strong) UIView *bgWhiteView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *contentLabel;

@end
@implementation ZYCMessageDutyCell

- (void)setModel:(ZYCMessageDutyModel *)model{
    _model = model;
    _titleLabel.text = [NSString stringWithFormat:@"%@提醒",model.msgTypeName];
    _contentLabel.text = model.msg;
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self.contentView addSubview:self.bgWhiteView];
        [self.bgWhiteView addSubview:self.titleLabel];
        [self.bgWhiteView addSubview:self.contentLabel];


        [self.bgWhiteView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(15.0f);
            make.right.equalTo(self.contentView).offset(-15.0f);
            make.top.bottom.equalTo(self.contentView);
        }];
        
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.bgWhiteView).offset(15.0f);
            make.right.equalTo(self.bgWhiteView).offset(-15.0f);
            make.top.equalTo(self.bgWhiteView).offset(14.0f);
        }];
        
        
        [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.bgWhiteView).offset(15.0f);
            make.right.equalTo(self.bgWhiteView).offset(-15.0f);
            make.top.equalTo(self.titleLabel.mas_bottom).offset(14.0f);
            make.bottom.equalTo(self.bgWhiteView).offset(-14.0f);
        }];

        
    }
    return self;
}


- (UIView *)bgWhiteView {
    if (!_bgWhiteView) {
        _bgWhiteView = [[UIView alloc] init];
        _bgWhiteView.backgroundColor = HEX_RGB(@"#FFFFFF");
        _bgWhiteView.layer.cornerRadius = 7.5;
        _bgWhiteView.layer.masksToBounds = YES;
    }
    return _bgWhiteView;
}
- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Regular", 18) titleColor:HEX_RGB(@"#333333") textAlignment:ZZTextAlignmentLeft];
    }
    return _titleLabel;
}

- (UILabel *)contentLabel {
    if (!_contentLabel) {
        _contentLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Light", 14) titleColor:HEX_RGB(@"#999999") textAlignment:ZZTextAlignmentLeft];
        _contentLabel.numberOfLines = 0;
    }
    return _contentLabel;
}


@end
